// 生产管理模块API
import {
  getAction,
  deleteAction,
  putAction,
  putparamsAction,
  postAction,
  postParamsAction,
  httpAction
} from '@/api/manage'

// 生产工单
export const workOrderAdd = (params) => postAction('/jksaas-produce/produce/produceManagement/workOrder/add', params) // 新增工单
export const workOrdequeryById = (params) => getAction('/produceorder/produceOrderInfo/queryById', params) // 新增工单
export const processDetailList = (params) => getAction('/jksaas-produce/produce/baseSetting/process/detailList', params) // 查询工序
export const processWorkTeamQueryByProcess = (params) =>
  getAction('/jksaas-produce/produce/processWorkTeam/processWorkTeam/queryByProcess', params) // 根据工序查班组
export const queryDeviceByProcess = (params) =>
  getAction('/jksaas-produce/produce/processdevice/processWorkDevice/queryByProcess', params) // 根据工序查设备
export const queryDetailVoByGoodsId = (params) =>
  getAction('/jksaas-produce/produce/bom/queryDetailVoByGoodsId', params) // 获取商品BOM明细
export const workOrderDetailQueryById = (params) =>
  getAction('/jksaas-produce/produce/produceManagement/workOrder/queryById', params) // 工单详情
export const updatePriority = (params) =>
  postAction('/jksaas-produce/produce/produceManagement/workOrder/updatePriority', params) // 更改优先级
export const voidedWorkOrder = (params) =>
  postParamsAction('/jksaas-produce/produce/produceManagement/workOrder/voided', params) // 作废工单
export const getWorkOrderList = (params) =>
  getAction('/jksaas-produce/produce/mess/messProductOrder/list', params) // 工单列表查询
export const startWorkOrder = (params) =>
  postParamsAction('/jksaas-produce/produce/produceManagement/workOrder/start', params) // 工单开始
export const finishWorkOrder = (params) =>
  postParamsAction('/jksaas-produce/produce/produceManagement/workOrder/finish', params) // 工单批量完成
export const startCalibration = (params) =>
  getAction('/jksaas-produce/produce/produceManagement/workOrder/startCalibration', params) // 工单批量开始校验
export const finishCalibration = (params) =>
  getAction('/jksaas-produce/produce/produceManagement/workOrder/finishCalibration', params) // 工单批量完成校验
export const voidedCalibration = (params) =>
  getAction('/jksaas-produce/produce/produceManagement/workOrder/voidedCalibration', params) // 工单批量完成校验
export const workerPrint = (params) => getAction('/jksaas-produce/produce/produceManagement/workOrder/print', params) // 工单打印
export const queryMaterialsRecord = (params) =>
  getAction('/jksaas-produce/produce/produceManagement/workOrder/queryMaterialsRecord', params) // 工单详情-用料记录

// 工艺路线变更记录
export const produceOrderAlterRecordAdd = (params) =>
  postAction('/jksaas-produce/produce/produceOrderAlterRecord/add', params) // 新建变更
export const produceOrderAlterRecordList = (params) =>
  getAction('/jksaas-produce/produce/produceOrderAlterRecord/queryByPage', params) // 变更记录列表
export const produceOrderAlterRecordGetById = (params) =>
  getAction('/jksaas-produce/produce/produceOrderAlterRecord/getById', params) // 变更记录详情
export const produceOrderAlterRecordDelete = (params) =>
  deleteAction('/jksaas-produce/produce/produceOrderAlterRecord/delete', params) // 变更记录删除
export const produceWorkTeamQueryByPage = (params) =>
  getAction('/jksaas-produce/produce/produceWorkTream/queryByPage', params) // 班组查询
export const changeRecordWithdraw = (params) =>
  getAction('/jksaas-produce/produce/produceOrderAlterRecord/withdraw', params) // 班组查询

// 领料单
export const materialRequisitionList = (params) =>
  getAction('/jksaas-produce/produce/produceReceiveMaterial/queryByPage', params)
export const materialRequisitionAdd = (params) =>
  postAction('/jksaas-produce/produce/produceReceiveMaterial/add', params)
export const materialRequisitionWithdraw = (params) =>
  getAction('/jksaas-produce/produce/produceReceiveMaterial/withdraw', params) // 撤回
export const materialRequisitionDel = (params) =>
  deleteAction('/jksaas-produce/produce/produceReceiveMaterial/delete', params)
export const materialRequisitionDetail = (params) =>
  getAction('/jksaas-produce/produce/produceReceiveMaterial/getById', params)
export const getGoodsByOrderId = (params) =>
  getAction('/jksaas-produce/produce/produceReceiveMaterial/queryByOrderId', params) // 查询该工单下的物料

// 生产批次
export const produceBatchList = (params) => getAction('/jksaas-produce/produce/produceBatch/list', params) // 批次list
export const produceBatchAdd = (params) => postAction('/jksaas-produce/produce/produceBatch/add', params) // 新建批次
export const produceBatchAddInBulk = (params) => postAction('/jksaas-produce/produce/produceBatch/batchAdd', params) // 批量新建批次
export const produceBatchDelete = (params) => deleteAction('/jksaas-produce/produce/produceBatch/delete', params) // 删除批次
export const produceBatchEdit = (params) => postAction('/jksaas-produce/produce/produceBatch/edit', params) // 编辑批次
export const getBatchCodeByOrderId = (params) => getAction('/jksaas-produce/produce/produceBatch/getBatchCode', params) // 根据工单ID生成批次编号
export const getProcessListByOrderId = (params) =>
  getAction('/jksaas-produce/produce/baseSetting/process/queryByWorderOrder', params) // 查询工单ID获取工序
export const getmissionBatchList = (params) => getAction('/jksaas-produce/produce/produceBatch/missionBatch', params)

// 补料单
export const supplementaryMaterialList = (params) =>
  getAction('/jksaas-produce/produce/produceMaterialRemedy/queryByPage', params)
export const supplementaryMaterialAdd = (params) =>
  postAction('/jksaas-produce/produce/produceMaterialRemedy/add', params)
export const supplementaryMaterialWithdraw = (params) =>
  getAction('/jksaas-produce/produce/produceMaterialRemedy/withdraw', params) // 撤回
export const supplementaryMaterialDel = (params) =>
  deleteAction('/jksaas-produce/produce/produceMaterialRemedy/delete', params)
export const supplementaryMaterialDetail = (params) =>
  getAction('/jksaas-produce/produce/produceMaterialRemedy/getById', params)
export const getSupplementaryMaterialGoodsByOrderId = (params) =>
  getAction('/jksaas-produce/produce/produceMaterialRemedy/queryByOrderId', params) // 查询该工单下的物料

//退料单
export const materialReturnPage = (params) =>
  getAction('/jksaas-produce/produce/produceMaterialsReturned/queryByPage', params)
export const materialReturnAdd = (params) => postAction('/jksaas-produce/produce/produceMaterialsReturned/add', params)
export const materialReturnWithdraw = (params) =>
  getAction('/jksaas-produce/produce/produceMaterialsReturned/withdraw', params) // 撤回
export const getMaterialReturnGoodsByOrderId = (params) =>
  getAction('/jksaas-produce/produce/produceMaterialsReturned/queryByOrderId', params) // 查询该工单下的物料
export const materialReturnDel = (params) =>
  deleteAction('/jksaas-produce/produce/produceMaterialsReturned/delete', params)
export const materialReturnDetail = (params) =>
  getAction('/jksaas-produce/produce/produceMaterialsReturned/getById', params)
// 生产调度
// 查
export const productionSchedulingList = (params) =>
  getAction('/jksaas-produce/produce/management/productionScheduling/list', params)
// 增
export const productionSchedulingAdd = (params) =>
  postAction('/jksaas-produce/produce/management/productionScheduling/add', params)
// 删
export const productionSchedulingDelete = (params) =>
  deleteAction('/jksaas-produce/produce/management/productionScheduling/delete', params)
// 批量删除
export const productionSchedulingBatchIds = (params) =>
  deleteAction('/jksaas-produce/produce/management/productionScheduling/batchIds', params)
// 工单列表
export const workOrderList = (params) => getAction('/jksaas-produce/produce/produceManagement/workOrder/list', params)
// 工序信息
export const queryProcess = (params) =>
  getAction('/jksaas-produce/produce/management/productionScheduling/queryProcess', params)

//生产任务详情
export const productionTaskDetailsById = (params) =>
  getAction('/jksaas-produce/produce/management/productionTask/detailsById', params) // 报工记录

//生产报工
export const productionReportList = (params) =>
  getAction('/jksaas-produce/produce/management/productionReport/list', params) // 报工记录

// 合格品清单查询
export const produceQualifiedProductsQueryByPage = (params) =>
  getAction('/jksaas-produce/produce/produceQualifiedProducts/queryByPage', params) // 报工记录

// 合格品入库申请单
export const produceQualifiedProductsInboundApply = (params) =>
  getAction('/jksaas-produce/produce/produceQualifiedProductsInboundApply/queryByPage', params) // 合格品入库申请单

// 根据工序id获取详情信息
export const processMessage = (params) =>
  getAction('/jksaas-produce/produce/management/productionTask/processMessage', params)
// 生产工序信息列表
export const processList = (params) => getAction('/jksaas-produce/produce/baseSetting/process/list', params)
// 生产报工的详情
export const productionReportDetail = (params) =>
  getAction('/jksaas-produce/produce/management/productionReport/reportDetails', params) //生产报工
// 班组信息-查询
export const queryByPage = (params) => getAction('/jksaas-produce/produce/produceWorkTream/queryByPage', params)
// /设备列表信息
export const deviceList = (params) => getAction('/jksaas-produce/produce/mess/device/list', params)

// 合格品清单
export const QualifiedProductList = (params) =>
  getAction('/jksaas-produce/produce/produceQualifiedProducts/queryByPage', params)
export const QualifiedProductApply = (params) =>
  postAction('/jksaas-produce/produce/produceQualifiedProducts/applyInBound', params)
export const ModelIineInfo = (params) => getAction('/jksaas-produce/produce/proc/model/lineInfo', params)

// 合格品清单入库
export const ProductsInboundApply = (params) =>
  getAction('/jksaas-produce/produce/produceQualifiedProductsInboundApply/queryByPage', params)
export const ProductsInboundDetail = (params) =>
  getAction('/jksaas-produce/produce/produceQualifiedProductsInboundApply/getById', params)
export const InboundDetailList = (params) =>
  getAction('/jksaas-produce/produce/produceQualifiedProductsInboundApply/getProduceQualifiedProductsId', params)
export const ProductsInboundWithdraw = (params) =>
  getAction('/jksaas-produce/produce/produceQualifiedProductsInboundApply/withdraw', params)
export const ProductsInboundDelete = (params) =>
  deleteAction('/jksaas-produce/produce/produceQualifiedProductsInboundApply/delete', params)
// 生产-生产管理-计件工资明细
export const getPieceRateExtList = (params) =>
  getAction('/jksaas-produce/produce/produceTaskReportWorkPieceRateExt/queryByPage', params)

// 报工记录模块
// 生产报工
export const productionReportingList = (params) => getAction('/jksaas-produce/produce/management/productionReport/list', params)
export const productionReportingAdd = (params) => postAction('/reportwork/produceOrderReportWork/add', params)
export const productionReportingEdit = (params) => putAction('/reportwork/produceOrderReportWork/edit', params)
export const productionReportingDel = (params) => postAction('/jksaas-produce/produce/management/productionReport/saveReport', params)
export const processByOrderId = (params) => getAction('/jksaas-produce/produce/management/productionTask/processByOrderId', params)
export const processDetail = (params) => getAction('/reportwork/produceOrderReportWork/scheduleById', params)
export const produceBatch = (params) => getAction('/jksaas-produce/produce/produceBatch/queryTask', params)//获取批次
export const productionReportingDetail = (params) => getAction('/jksaas-produce/produce/management/productionReport/reportDetails', params)
export const productionDetail = (params) => getAction('/jksaas-produce/produce/management/productionReport/queryById', params) // 编辑查询详情
export const getFileListByIds = (params) => getAction('/produce/produceOrderTask/queryById', params) // 编辑查询详情
export const editForm = (params) => putAction('/produce/produceOrderTask/edit', params) // 编辑查询详情
export const detailId = (params) => getAction('/reportwork/produceOrderReportWork/queryById', params) // 编辑查询详情
export const deleteCOLT = (params) => deleteAction('/reportwork/produceOrderReportWork/delete', params) // 编辑查询详情
export const deleteCOLTAS = (params) => deleteAction('/reportwork/produceOrderReportWork/deleteBatch', params) // 编辑查询详情


//工序委外
export const getOutsourcingList = (params) => getAction('/jksaas-produce/produce/management/outsourcing/list', params)
export const outsourcingRegistration = (params) => getAction('/jksaas-produce/produce/management/outsourcing/registration', params)
export const outsourcingComplete = (params) => getAction('/jksaas-produce/produce/management/outsourcing/complete', params)
export const outsourcingBatchList = (params) => getAction('/jksaas-produce/produce/management/outsourcing/batchList', params)
export const outsourcingBatchAdd = (params) => postAction('/jksaas-produce/produce/management/productionReport/batchAdd', params)

// 获取访问路径

export const printUrl = (params) => getAction('/jksaas-produce/produce/printTemplate/printUrl', params)

// 生产工单投料 列表
export const getFeedList = (params) => getAction('/jksaas-produce/produce/produce/feeding/list', params)
export const feedListQueryByOrderId = (params) => getAction('/jksaas-produce/produce/produce/feed/queryByOrderId', params)
// 生产工单投料 详情
export const getFeedDetail = (params) => getAction('/jksaas-produce/produce/produce/feeding/queryById', params)
export const feedingAdd = (params) => postAction('/jksaas-produce/produce/produce/feeding/add', params)
// 工单报工
export const orderReport = (params) => postAction('/jksaas-produce/produce/management/productionReport/orderReport', params)
export const processAndGroup = (params) => getAction('/jksaas-produce/produce/produceManagement/workOrder/processAndGroup', params)
export const checkOrderReport = (params) => getAction('/jksaas-produce/produce/produceManagement/workOrder/checkOrderReport', params)

// 生产-物料管理-物料需求批次
export const produceProductionMaterialRequirementBatchList = (params) => getAction('/jksaas-produce/produce/materialRequirementBatch/produceProductionMaterialRequirementBatch/list', params)
export const produceProductionMaterialRequirementBatchAdd = (params) => postAction('/jksaas-produce/produce/materialRequirementBatch/produceProductionMaterialRequirementBatch/add', params)
export const produceProductionMaterialRequirementBatchDelete = (params) => deleteAction('/jksaas-produce/produce/materialRequirementBatch/produceProductionMaterialRequirementBatch/delete', params)
export const materialRequirementBatchQueryScheduled = (params) => getAction('/jksaas-produce/produce/materialRequirementBatch/produceProductionMaterialRequirementBatch/queryScheduled', params)
export const produceProductionMaterialRequirementBatchQueryGoodsDetail = (params) => getAction('/jksaas-produce/produce/materialRequirementBatch/produceProductionMaterialRequirementBatch/queryGoodsDetail', params)

// 生产工单-变更
export const orderChangeList = (params) => getAction('/jksaas-produce/produce/orderChange/list', params)
export const orderChangeAdd = (params) => postAction('/jksaas-produce/produce/orderChange/add', params)
export const orderUpdate = (params) => postAction('/jksaas-produce/produce/produceManagement/workOrder/orderUpdate', params)
export const queryMaterialsBatch = (params) => getAction('/jksaas-produce/produce/produceManagement/workOrder/queryMaterialsBatch', params)

//人员分值记录
export const scoreRecordList = (params) => getAction('/jksaas-produce/produce/score/record/list', params)
export const setScorePrice = (params) => postAction('/jksaas-produce/produce/score/record/setScorePrice', params)
export const updateRecordPrice = (params) => postAction('/jksaas-produce/produce/score/record/updateRecordPrice', params)

//打印模板管理
export const printTemplateList = (params) => getAction('/jksaas-produce/produce/printTemplate/list', params)
export const printTemplateEdit = (params) => putAction('/jksaas-produce/produce/printTemplate/edit', params)
